我有两个相应的列表:
public class BookOverallData {
private Long idOfBook;
private String title;
private String authour;
private BigDecimal basePrice;
private Integer discountRate;
}
public class TimeDiscount {
private Long idOfBook;
private Integer discountRate;
}
Set<BookOverallData> booksToReturn
Set<TimeDiscount> actualPromotions
Run Code Online (Sandbox Code Playgroud)
我们的目标是要总结的折扣,这意味着将discountRate来自actualPromotions于discountRate价值从booksToReturn列表中.两个列表中的对象可以匹配idOfBook.
这就是我解决它的方式
booksToReturn.forEach(
p -> {
final Optional<TimeDiscount> promotion = actualPromotions.stream().filter(ap -> Objects.equals(ap.getIdOfBook(), p.getIdOfBook())).findFirst();
promotion.ifPresent(ap -> p.setDiscountRate(ap.getDiscountRate() + p.getDiscountRate()));
}
);
Run Code Online (Sandbox Code Playgroud)
我只是在探索溪流,我认为我的解决方案是块状的.如何使用流和功能方法以更优雅的方式解决这个问题?
当用户在一个活动中单击按钮时,我需要处理一些数据,因此屏幕看起来像应用程序停止2-3秒.它并不是很多,但我想向用户提供一切正常的信息,IMO最好的方法是只有在处理数据时才能看到的进度条.
我找到了ProgressBar的代码,它看起来像这样:
<ProgressBar
android:id="@+id/loadingdata_progress"
style="?android:attr/progressBarStyle"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignBottom="@+id/fin2_note"
android:layout_centerHorizontal="true"
android:indeterminate="true"
android:visibility="invisible" />
Run Code Online (Sandbox Code Playgroud)
并将其插入我的布局中间.
并尝试进度条的工作原理,我把这个代码
loadingimage= (ProgressBar) findViewById(R.id.loadingdata_progress);
loadingimage.setVisibility(View.VISIBLE);
进入onCreate方法,一切都很好.然后我重新创建代码以仅在处理数据时显示此进度条.
单击后,用户调用此方法
public void fin2_clickOnFinalization(View v)
{
loadingimage= (ProgressBar) findViewById(R.id.loadingdata_progress);
loadingimage.setVisibility(View.VISIBLE);
// code where data is processing
loadingimage.setVisibility(View.INVISIBLE);
}
Run Code Online (Sandbox Code Playgroud)
并且屏幕上没有任何内容.我不知道哪里出错了.如果我通过id找到了进度条,对我来说很奇怪,我可以在onCreate方法中控制它,但是在onclick方法中它不受我的控制.
我正在使用 Weblogic 12.1.3.0 服务器,但我现在想要,可以在我的 pom 中按照提供的方式标记哪些依赖项。所以问题是,我在哪里可以找到 weblogic 提供的依赖项及其版本的完整列表?
我在这个标识符下找到了 weblogic 的 pom:
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-server-pom</artifactId>
<version>12.1.3-0-0</version>
<packaging>pom</packaging>
Run Code Online (Sandbox Code Playgroud)
但在我看来,此 pom 提供的依赖项列表并未显示 weblogic 提供的所有依赖项。
我也在oracle网站上搜索过,但没有任何令人满意的结果。
我尝试将 Java Mission Control (JMC) 与Wildfly 16连接起来。应用程序服务器位于 Docker 上。
我通过 jconsole 成功连接到 wildfly,为了管理它,我按照此处描述的步骤进行了管理。
不幸的是,我没有运气通过 JMC 连接。我使用的 URL 如下所示:
服务:jmx:remoting-jmx://192.168.99.100:9990
Unable to connect错误。Unable to connect.然后,我在这里找到了硬编码一些 jboss 类以通过 remoting-jmx 启用连接的想法。我根据wildfly16提供的这些更改了jars的版本,并像这样将其放入jmc.ini。
-Xbootclasspath/a:"C:/Program Files/Java/jdk-10.0.2/lib/missioncontrol/dropins/jboss-cli-client.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/remoting-jmx/main/remoting-jmx-3.0.1.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/remoting/main/jboss-remoting-5.0.8.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/logging/main/jboss-logging-3.3.2.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/xnio/main/xnio-api-3.6.5.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/xnio/nio/main/xnio-nio-3.6.5.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/marshalling/main/jboss-marshalling-2.0.6.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/marshalling/river/main/jboss-marshalling-river-2.0.6.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/as/cli/main/wildfly-cli-8.0.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/staxmapper/main/staxmapper-1.3.0.Final;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/as/protocol/main/wildfly-protocol-8.0.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/dmr/main/jboss-dmr-1.5.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/as/controller-client/main/wildfly-controller-client-8.0.0.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/threads/main/jboss-threads-2.3.3.Final.jar;C:/wildfly-16.0.0.Final/modules/system/layers/base/org/jboss/logmanager/main/jboss-logmanager-2.1.7.Final.jar"
Run Code Online (Sandbox Code Playgroud)
在那之后,最后,我有另一个错误,那就是
无法初始化类 org.jboss.remotingjmx.RemotingConnector
我添加了remoting-jmx-3.0.1.Final对 Xbootclasspath 的依赖项,但仍然出现相同的错误。
我的问题是,您知道如何使这种连接有效吗?也许有人以不同的方式做到了?
任何建议我如何调试这个问题,将是无价的?因为我缺乏如何解决它的想法。
我在显示一个太大而无法在一个面板上看到的图表时遇到问题.我必须滚动条,它应该改变图上的视角,但是当我想滚动图片时,形状在不同的位置移动,一切都被压碎了.
当我展示它时,它看起来像这里的链接,当我试图在图表的底部看时 ,像这里链接
看起来应用程序每次滚动面板时绘制形状,当我进入图片底部时,左上角的点仍然是(0,0)不是(0,500)
我有算法,它给出了面板上的位置值和对象的nr id到数组,然后我有绘制它的循环,从字典获取有关对象的信息和他从阵列的位置.
这个问题怎么解决?对于任何建议都是如此
编辑我不想再绘制它我想绘制一个大图,这样的东西(评论中的链接),但我知道用户可以制作例如50个对象(形状),那种大图不能被看到小面板所以我们必须有机会滚动并看到他想要的grapf,左侧或这一侧的底部.
我将尝试提供有关应用程序的更多详细信息.午餐时,您会看到控制面板(form1),您在其中添加events/functions/xor /或每个选项在图表上都有自己的形状.因此,用户添加例如带有文本的事件,按下按钮add,创建对象并将其添加到集合中.他可以添加事件/功能,xor /或他想要的任意数量.
好吧,当他添加他想要的所有内容时,现在他想看图,所以他按下按钮"生成图表",现在应用程序正在显示下一个带有面板和滚动条的windwow.您可以在链接中看到该窗口.在这一行之后的第二种形式
private void panel1_Paint(object sender, PaintEventArgs e){
Run Code Online (Sandbox Code Playgroud)
我有将坐标值放到表中的算法,然后forech循环从字典(集合)中获取:
从数组循环获取坐标值.
这个如何工作,我还可以在需要的时候把代码放在这里.
我需要使用json.net进行json序列化和反序列化,但是我遇到了安装此软件包的问题.正如我在网站上看到的, 它支持wp 7.1和silverilight.当我在控制台中输入时Install-Package Newtonsoft.Json
Installing 'Newtonsoft.Json 6.0.1'.
Successfully installed 'Newtonsoft.Json 6.0.1'.
Adding 'Newtonsoft.Json 6.0.1' to Connected.
Uninstalling 'Newtonsoft.Json 6.0.1'.
Successfully uninstalled 'Newtonsoft.Json 6.0.1'.
Install failed. Rolling back...
Install-Package : Could not install package 'Newtonsoft.Json 6.0.1'. You are trying to install this package into a project tha
t targets 'Silverlight,Version=v4.0,Profile=WindowsPhone71', but the package does not contain any assembly references or conte
nt files that are compatible with that framework. For more information, contact the package author.
At line:1 …Run Code Online (Sandbox Code Playgroud) 我试着更深入地描述我的问题.我有完整列出的项目 ObservableCollection<show>,在某些情况下,我需要在列表框项目区域显示正确值的DIAMETER SIGN.
例如

如果我想在每个框中都有它,我会把它硬编码或用硬编码值绑定,但只有部分项目具有应该用直径符号显示的值.这是show类的代码片段,它应该返回正确的符号
public string Thickness
{
get
{
if (thickness == 1)
{
return "⌀28cm";
}
else if (thickness == 2)
{
return "⌀50cm";
}
else
{
return "";
}
}
}
Run Code Online (Sandbox Code Playgroud)
和我的代码片段来自xaml
<TextBlock
Foreground="#69AB5C"
FontSize="15"
VerticalAlignment="Bottom"
Text="{Binding Thickness}">
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
在这里我应该如何从我的可观察集合中将unicode字符传递给xaml